<?php
declare(strict_types=1);

namespace LowCode\Traits\Vue;


trait HasMethod
{
    /**
     * @param string $name
     * @param string $callback
     * @return $this
     */
    public function method(string $name, string $callback): static
    {
        $this->builder->method->put($name, "const $name = $callback");
        $this->variables->add($name);
        return $this;
    }


    protected function getMethodHtml(): string
    {
        $values = $this->builder->method->all();
        return $this->implode($values);
    }
}
